package com.tiancheng.trade.payment.controller.api;

import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.commom.web.model.request.PayWayListQueryReq;
import com.tiancheng.trade.commom.web.model.request.PaymentPayWayQueryRequest;
import com.tiancheng.trade.commom.web.model.response.PaymentPayWayQueryResponse;
import com.tiancheng.trade.payment.service.PaymentWayService;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import jakarta.validation.constraints.NotBlank;

import java.util.List;

/**
 * 支付方式
 */
@RestController
@RequestMapping("/api/paymentWay")
@Validated
public class PaymentWayApiController {

    @Resource
    private PaymentWayService paymentWayService;

    /**
     * 获取渠道支付方式
     * @param payWayQueryRequest 渠道编码
     * @return 渠道编码对应的支付方式
     */
    @PostMapping("/getByChannelCode")
    public Result<List<PaymentPayWayQueryResponse>> get(@RequestBody @Valid PaymentPayWayQueryRequest payWayQueryRequest) {
        return Result.success(paymentWayService.queryOrgPayWay(payWayQueryRequest));
    }


    @PostMapping("/getByPaySceneChannelId")
    public Result<List<PaymentPayWayQueryResponse>> get(@RequestBody @Valid PayWayListQueryReq payWayListQueryReq) {
        return Result.success(paymentWayService.queryOrgPayWayList(payWayListQueryReq));
    }
}
